package com.cts.security;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
public class LoginController {
	public LoginController() {
		System.out.println("In constructor !!!");
	}

	/*@RequestMapping(value="/welcome/welcome", method = RequestMethod.GET)
	public String checkLogin(ModelMap model) {
		model.addAttribute("message", "Welcome here.");
		return "hello";
	}
	
	@RequestMapping(value="/index", method = RequestMethod.GET)
	public String indexPage(ModelMap model) {
		model.addAttribute("message", "This is an index page.");
		return "index";
	}*/
	
	@RequestMapping(value="/loginfailed", method = RequestMethod.GET)
	public String loginerror(ModelMap model) {
		System.out.println("Hhiiiiiiiiiiiiii");
		model.addAttribute("error", "true");
		return "login";
	}
	
	@RequestMapping(value="/loginError", method = RequestMethod.GET)
	public String loginError(ModelMap model) {
		System.out.println("Login error");
		model.addAttribute("error", "true");
		throw new NullPointerException();
	}

}
